<?php

require_once("defines_inc.php");
require_once("phpMailer/class.phpmailer.php");

class email_api
{
	public function __construct() 
	{		
    }	
	
	private function cerate_php_mailer()
	{
		$mail = new PHPMailer();
		$mail->FromName = "Creative";
		
		$mail->CharSet = "utf-8";	
		$mail->IsHTML(true);
		
		$mail->Host = "mellowart.nazwa.pl";
		$mail->Port = 465;
		$mail->Username = "studio@mellowart.pl";
		$mail->Password = "7HeavenS!";
		$mail->SMTPSecure = "ssl";
		$mail->SetFrom('studio@mellowart.pl', 'MellowArt');
		
		$mail->IsSMTP();
		$mail->SMTPAuth = true;
		
		return $mail;
	}
	
	private function get_mail_template()
	{
		return "{body}";
	}
	
	public function send_validation_email($email, $hash, $user_name)
	{
		$mail = $this->cerate_php_mailer();
		
		$mail->Subject = "wiadomość z serwisu profaktura";
		$mail->AddAddress("studio@mellowart.pl", "MellowArt");

		
		$link = sprintf("%sregister/%s/%s", SERVER_URL, $email, $hash);	
		$text = "";
		
		$body = str_replace("{body}", $text, $this->get_mail_template());
			
		$mail->MsgHTML($body);
		
		//$mail->send();
	}
	
	public function send_recorver_password($email)
	{
	}
}

?>